3.63 \(\int \frac{\sin ^2(e+f x)}{a+b \tan ^2(e+f x)} \, dx\)

Optimal. Leaf size=82 \[ -\frac{\sqrt{a} \sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{f (a-b)^2}-\frac{\sin (e+f x) \cos (e+f x)}{2 f (a-b)}+\frac{x (a+b)}{2 (a-b)^2} \]

[Out]

((a + b)*x)/(2*(a - b)^2) - (Sqrt[a]*Sqrt[b]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/((a - b)^2*f) - (Cos[e +
f*x]*Sin[e + f*x])/(2*(a - b)*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0968373, antiderivative size = 82, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.217, Rules used = {3663, 471, 522, 203, 205} \[ -\frac{\sqrt{a} \sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{f (a-b)^2}-\frac{\sin (e+f x) \cos (e+f x)}{2 f (a-b)}+\frac{x (a+b)}{2 (a-b)^2} \]

Antiderivative was successfully verified.

[In]

Int[Sin[e + f*x]^2/(a + b*Tan[e + f*x]^2),x]

[Out]

((a + b)*x)/(2*(a - b)^2) - (Sqrt[a]*Sqrt[b]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/((a - b)^2*f) - (Cos[e +
f*x]*Sin[e + f*x])/(2*(a - b)*f)

Rule 3663

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff^(m + 1))/f, Subst[Int[(x^m*(a + b*(ff*x)^n)^p)/(c^2 + ff^2*x^2
)^(m/2 + 1), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2]

Rule 471

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[(e^(n -
1)*(e*x)^(m - n + 1)*(a + b*x^n)^(p + 1)*(c + d*x^n)^(q + 1))/(n*(b*c - a*d)*(p + 1)), x] - Dist[e^n/(n*(b*c -
 a*d)*(p + 1)), Int[(e*x)^(m - n)*(a + b*x^n)^(p + 1)*(c + d*x^n)^q*Simp[c*(m - n + 1) + d*(m + n*(p + q + 1)
+ 1)*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, q}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[p, -1] && GeQ[n
, m - n + 1] && GtQ[m - n + 1, 0] && IntBinomialQ[a, b, c, d, e, m, n, p, q, x]

Rule 522

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{\sin ^2(e+f x)}{a+b \tan ^2(e+f x)} \, dx &=\frac{\operatorname{Subst}\left (\int \frac{x^2}{\left (1+x^2\right )^2 \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{\cos (e+f x) \sin (e+f x)}{2 (a-b) f}+\frac{\operatorname{Subst}\left (\int \frac{a-b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{2 (a-b) f}\\ &=-\frac{\cos (e+f x) \sin (e+f x)}{2 (a-b) f}-\frac{(a b) \operatorname{Subst}\left (\int \frac{1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{(a-b)^2 f}+\frac{(a+b) \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{2 (a-b)^2 f}\\ &=\frac{(a+b) x}{2 (a-b)^2}-\frac{\sqrt{a} \sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{(a-b)^2 f}-\frac{\cos (e+f x) \sin (e+f x)}{2 (a-b) f}\\ \end{align*}

Mathematica [A]  time = 0.140003, size = 69, normalized size = 0.84 \[ \frac{2 (a+b) (e+f x)+(b-a) \sin (2 (e+f x))-4 \sqrt{a} \sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{4 f (a-b)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[e + f*x]^2/(a + b*Tan[e + f*x]^2),x]

[Out]

(2*(a + b)*(e + f*x) - 4*Sqrt[a]*Sqrt[b]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]] + (-a + b)*Sin[2*(e + f*x)])/(
4*(a - b)^2*f)

________________________________________________________________________________________

Maple [A]  time = 0.062, size = 137, normalized size = 1.7 \begin{align*} -{\frac{ab}{f \left ( a-b \right ) ^{2}}\arctan \left ({b\tan \left ( fx+e \right ){\frac{1}{\sqrt{ab}}}} \right ){\frac{1}{\sqrt{ab}}}}-{\frac{\tan \left ( fx+e \right ) a}{2\,f \left ( a-b \right ) ^{2} \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) }}+{\frac{b\tan \left ( fx+e \right ) }{2\,f \left ( a-b \right ) ^{2} \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) }}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) a}{2\,f \left ( a-b \right ) ^{2}}}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) b}{2\,f \left ( a-b \right ) ^{2}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(f*x+e)^2/(a+b*tan(f*x+e)^2),x)

[Out]

-1/f*b/(a-b)^2*a/(a*b)^(1/2)*arctan(b*tan(f*x+e)/(a*b)^(1/2))-1/2/f/(a-b)^2*tan(f*x+e)/(1+tan(f*x+e)^2)*a+1/2/
f/(a-b)^2*tan(f*x+e)/(1+tan(f*x+e)^2)*b+1/2/f/(a-b)^2*arctan(tan(f*x+e))*a+1/2/f/(a-b)^2*arctan(tan(f*x+e))*b

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.88243, size = 674, normalized size = 8.22 \begin{align*} \left [\frac{2 \,{\left (a + b\right )} f x - 2 \,{\left (a - b\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) + \sqrt{-a b} \log \left (\frac{{\left (a^{2} + 6 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \,{\left (3 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{2} + 4 \,{\left ({\left (a + b\right )} \cos \left (f x + e\right )^{3} - b \cos \left (f x + e\right )\right )} \sqrt{-a b} \sin \left (f x + e\right ) + b^{2}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{4} + 2 \,{\left (a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + b^{2}}\right )}{4 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} f}, \frac{{\left (a + b\right )} f x -{\left (a - b\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) + \sqrt{a b} \arctan \left (\frac{{\left ({\left (a + b\right )} \cos \left (f x + e\right )^{2} - b\right )} \sqrt{a b}}{2 \, a b \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right )}{2 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} f}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

[1/4*(2*(a + b)*f*x - 2*(a - b)*cos(f*x + e)*sin(f*x + e) + sqrt(-a*b)*log(((a^2 + 6*a*b + b^2)*cos(f*x + e)^4
 - 2*(3*a*b + b^2)*cos(f*x + e)^2 + 4*((a + b)*cos(f*x + e)^3 - b*cos(f*x + e))*sqrt(-a*b)*sin(f*x + e) + b^2)
/((a^2 - 2*a*b + b^2)*cos(f*x + e)^4 + 2*(a*b - b^2)*cos(f*x + e)^2 + b^2)))/((a^2 - 2*a*b + b^2)*f), 1/2*((a
+ b)*f*x - (a - b)*cos(f*x + e)*sin(f*x + e) + sqrt(a*b)*arctan(1/2*((a + b)*cos(f*x + e)^2 - b)*sqrt(a*b)/(a*
b*cos(f*x + e)*sin(f*x + e))))/((a^2 - 2*a*b + b^2)*f)]

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)**2/(a+b*tan(f*x+e)**2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.40066, size = 153, normalized size = 1.87 \begin{align*} -\frac{\frac{2 \,{\left (\pi \left \lfloor \frac{f x + e}{\pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (b\right ) + \arctan \left (\frac{b \tan \left (f x + e\right )}{\sqrt{a b}}\right )\right )} a b}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \sqrt{a b}} - \frac{{\left (f x + e\right )}{\left (a + b\right )}}{a^{2} - 2 \, a b + b^{2}} + \frac{\tan \left (f x + e\right )}{{\left (\tan \left (f x + e\right )^{2} + 1\right )}{\left (a - b\right )}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

-1/2*(2*(pi*floor((f*x + e)/pi + 1/2)*sgn(b) + arctan(b*tan(f*x + e)/sqrt(a*b)))*a*b/((a^2 - 2*a*b + b^2)*sqrt
(a*b)) - (f*x + e)*(a + b)/(a^2 - 2*a*b + b^2) + tan(f*x + e)/((tan(f*x + e)^2 + 1)*(a - b)))/f